package com.mz.ozy.adapter;

import android.text.TextUtils;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mz.ozy.R;
import com.mz.ozy.bean.FriendBean;
import com.mz.ozy.bean.MyBounsRecodeBean;
import com.mz.ozy.utils.Utils;
import com.mz.ozy.utils.glideUtils.GlideUtils;

import java.util.List;

/**
 *
 */

public class FriendListAdapter extends BaseQuickAdapter<FriendBean.PageBean.PageItemsBean, BaseViewHolder> {
    private int type;
    private String inviteCode;

    public FriendListAdapter(List<FriendBean.PageBean.PageItemsBean> data, int type) {
        super(R.layout.item_my_friend_list, data);
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, FriendBean.PageBean.PageItemsBean item) {
        if (TextUtils.isEmpty(item.getInvitecode())) {
            helper.setText(R.id.tv_operate_type, "");
        } else {
            helper.setText(R.id.tv_operate_type, "推荐码： " + item.getInvitecode());
        }
        int grade = item.getGrade();
        if (grade == 0) {
            helper.setText(R.id.tv_order_seq, item.getUsername() + "    " + item.getUname());
        } else {
            helper.setText(R.id.tv_order_seq, item.getUsername() + "    " + item.getUname());
        }

        helper.setText(R.id.tv_operate_state, item.getRegtime());
        ImageView imageView = helper.getView(R.id.image_logo);
        GlideUtils.loadFriAvatar(mContext, imageView, item.getUseravatar());
        switch (item.getGrade()) {
            case 0:
                helper.setText(R.id.tv_type, "普通会员");

                break;
            case 1:
                helper.setText(R.id.tv_type, "VIP");

                break;
            case 2:
                helper.setText(R.id.tv_type, "金卡");

                break;
            case 3:
                helper.setText(R.id.tv_type, "钻卡");

                break;
            case 4:
                helper.setText(R.id.tv_type, "健康顾问");
                break;
            case 5:
                helper.setText(R.id.tv_type, "资深顾问");
                break;
            case 6:
                helper.setText(R.id.tv_type, "蓝宝顾问");
                break;
            case 7:
                helper.setText(R.id.tv_type, "绿宝顾问");
                break;
            case 8:
                helper.setText(R.id.tv_type, "红宝督导");
                break;
            case 9:
                helper.setText(R.id.tv_type, "蓝钻督导");
                break;
            case 10:
                helper.setText(R.id.tv_type, "绿钻督导");
                break;
            case 11:
                helper.setText(R.id.tv_type, "红钻督导");
                break;
            case 12:
                helper.setText(R.id.tv_type, "黑钻首席");
                break;
        }


    }


    public void setInvitecode(String invitecode) {
        this.inviteCode = invitecode;
        notifyDataSetChanged();
    }
}
